﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EBookStore.Books;
using EBookStore.Orders;

namespace EBookStore.Users
{
    public abstract class User
    {

        #region Properties

        private string _id;
        private string _login;
        private string _password;

        public string Login { get { return _login; } }
        public string Password { get { return _password; } }
        public string ID { get { return _id; } }
        public string FirstName { get; set; }
        public string LastName { get; set; }

  
        #endregion


        #region Functions

        public User( string login, string password,string firstName, string lastName)
        {
            this._login = login;
            this._password = password;
            this.FirstName=firstName;
            this.LastName = lastName;
            this._id = Utils.IDGenerator.CreateUniqeID();

            ValidateData();
        }

        /// <summary>
        /// validate data
        /// </summary>
        protected virtual void ValidateData()
        {
            if (String.IsNullOrEmpty(FirstName) || String.IsNullOrEmpty(LastName))
            {
                throw new Exception("First or/both Last name is/are empty");
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Message"></param>
        public virtual bool SendMessage(string Message){

            /// send message of any spesified type (in the future)
            /// mail/sms...

            return true;
        }

        protected abstract void ConcreteValidator();

        #endregion


    }
}
